package com.onlineexam.mapper;


import com.onlineexam.bean.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper {

    @Select("select * from `user` where `username`=#{username} and `password`=md5(#{password})")
    User login(User user);

    @Insert("INSERT INTO `user` (userid, username, password, role, create_time, is_deleted) VALUES(#{userid}, #{username}, md5(#{password}), 0, NOW(), 0);")
    int reg(User user);

    @Select("SELECT b.*,class as 'banji',create_time as 'createTime',is_deleted as 'isDeleted' from `user` b;")
    List<User> list();



}
